package com.onetoall.yjt;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

/**
 * Created by DELL on 2016/12/29.
 */

public class MyView extends View {

    private  int xPoint = 60;
    private int yPoint = 700;

    private int XScale = 8;  //刻度长度
    private int YScale = 40;
    private int XLength = 600;
    private int YLength = 500;

    private int MaxDataSize = XLength / XScale;


    public MyView(Context context) {
        super(context);


    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setAntiAlias(true); //去锯齿
        paint.setColor(Color.BLUE);

        //画Y轴
        canvas.drawLine(xPoint, yPoint - YLength, xPoint, yPoint, paint);

        //Y轴箭头
        canvas.drawLine(xPoint, yPoint - YLength, xPoint - 3, yPoint-YLength + 6, paint);  //箭头
        canvas.drawLine(xPoint, yPoint - YLength, xPoint + 3, yPoint-YLength + 6 ,paint);

        canvas.drawLine(xPoint, yPoint, xPoint + XLength, yPoint, paint);


    }
}
